import Application from './route';

interface ApiRequest {
    merchantId?: number;
    phone?: string;
    code?: string;
    name?: string;
    product?: string;
    date?: string;
    qrcode?: string;
}

class ApiResult {
    code: number;
    msg?: string;
    constructor (code: number, msg?: string) {
        this.code = code;
        this.msg = msg;
    }
}

const app = new Application(3000);

app.use<ApiRequest, ApiResult>('*', async (ctx) => {
    console.log('method / arg is ', ctx.parameters);
    return new ApiResult(0, "ok");
});
